package game;

import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
import javax.swing.JFileChooser;

public class PauseMenu extends Menu{
    protected BufferedImage background;
    protected Color trans;
    protected Console con;
    protected boolean firstPress = true;

    public PauseMenu(GrandeCanvas c){
        super(c);
        elements.add(new MenuButton(this, (c.fwidth/2) - (200 + 25), (c.fheight/2) - 100, 200, 50,"Level Select", 30, new LevelMenu(this)));
        elements.add(new MenuButton(this, (c.fwidth/2) + 25, (c.fheight/2) - 100, 200, 50,"Sound", 30, new SoundMenu(this)));
        elements.add(new MenuButton(this, (c.fwidth/2) - (200 + 25), (c.fheight/2) - 25, 200, 50, "Resume", 30, null){
            @Override
			public void clicked(MouseEvent e){
            	getCanvas().resumeGame();
            }
        });
        elements.add(new MenuButton(this, (c.fwidth/2) + 25, (c.fheight/2) - 25, 200, 50, "Quit Game", 30, null){
            @Override
			public void clicked(MouseEvent e){
            	canvas.quitGame();
            }
        });
        elements.add(new MenuButton(this, (c.fwidth/2) - (450/2), (c.fheight/2) + 50, 450, 50, "Controls", 30, new ControlMenu(this)));
        trans = new Color(0, 0, 0, 150);
    }

    @Override
	public void draw(){
        if(canvas.bufGraphics != null){
            canvas.bufGraphics.setColor(trans);
            canvas.bufGraphics.fillRect(0, 0, canvas.width, canvas.height);
            super.draw();
        }
    }

    @Override
	public void keyPress(int keycode){
        if(subMenu != null){
            subMenu.keyPress(keycode);
            return;
        }
    }
}